package com.example.spider.task.limit;

import com.example.spider.task.AbstractSpiderTask;
import com.example.spider.task.Task;

/**
 * 默认，不限流
 *
 * @author lym
 */
public class NoLimit implements LimitStrategy {

    public static final NoLimit INSTANCE = new NoLimit();

    public static NoLimit getInstance() {
        return INSTANCE;
    }

    @Override
    public String getKey() {
        return "NoLimit";
    }

    @Override
    public boolean needLimit(Task<?> task) {
        return false;
    }

    @Override
    public void doLimit(AbstractSpiderTask<?> task) {

    }

    @Override
    public <T> void afterRequest(Task<T> task, T result, Throwable ex, long endTime) {

    }

    @Override
    public LimitStrategy copyWithNewKey(String s) {
        return INSTANCE;
    }
}
